#include <bits/stdc++.h>

#define ll long long
#define ull unsigned long long
#define uint unsigned int
#define endl '\n'

const int INF = 1e9;
const int MOD = 998244353;

#define YES cout << "YES" << '\n'
#define NO cout << "NO" << '\n'

using namespace std;

/*思考

*/

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    string ac = "Accepted";
    string re = "Rejected";
    string stat;
    cin >> stat;
    int n, t;
    cin >> n >> t;
    int ans = 0;
    if (stat == ac) {
        ans = t + (n - 1) * 20;
    }
    cout << ans << endl;
    return 0;
}